<?php

  // This line should usually be commented out for security purposes.
  // Only use this setting for debugging.
  ini_set(display_errors, 1);

	//define("appName", "CondorDB");
	define("appName", "Quill");

	/**
	  The printHeader function prints out the header stuff for
	  a page so that we don't have to do it manually each time
	*/
	function printHeader($title = '') {
		echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
		echo "<head>\n";
		echo "<title>", appName;
		if ($title != '') echo " - {$title}";
		echo "</title>\n";
		echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" />\n";
		echo "<link rel=\"stylesheet\" href=\"global.css\" type=\"text/css\" />\n";
		echo "</head>\n";
		/* echo "<p>Session Id: ", session_id(), "...\n<p>"; */
	}


	/**
	  The printBody function adds the body tag to a page.  The optional
	  bodyClass parameter is for using css.
	*/
	function printBody($bodyClass = '') {
		echo "<body";
		if ($bodyClass != '') echo " class=\"{$bodyClass}\"";
		echo ">\n";
		
	}

	/**
	  The printFooter function ends a page.  the optional doBody param
	  indicates whether or not to a a closing body tag.
	*/
	function printFooter($doBody = true) {
		if($doBody) echo "</body>\n";
		echo "</html>\n";
	}

        /** The cdbBody puts out the appropriate body tag(s)
        */
        function cdbBody() {
          echo "<body bgcolor='#FFFFFF' text='#000000' link='#0000CD' " . 
               "vlink='#008000' alink='#FF0000' leftmargin='0' " . 
               "topmargin='0' marginwidth='0' marginheight='0'>\n";
          echo "<font face=Verdana, Arial, Helvetica, Sans>\n";

        }

        /** The cdbSetUp function puts in all of the soruounding
            'stuff' to make the pages all look the same
        */
        function cdbSetUp() {
          $imgTrans = "'./images/transparent.gif'";

          echo "<table width=100% border=0 cellspacing=0 cellpadding=0>\n";
          //top of page
          echo "<tr background='./images/lt_blue.gif'>\n";
          echo "<td width=10>\n";
          echo "<img src={$imgTrans} width=10 height=10>\n";
          echo "</td>\n";
          echo "<td width=165>\n";
          echo "<img src={$imgTrans} width=165 height=10>\n";
          echo "</td>\n";
          echo "<td width=10>\n";
          echo "<img src={$imgTrans} width=10 height=10>\n";
          echo "</td>\n";

          //user name
          echo "<td align=left valign=bottom>\n";
	  echo "<font size=-1>Username: {$_SESSION["loginUsername"]} </font>\n";
	  echo "</td>\n";

	  //change password
	 // echo "<td align=center valign=bottom>\n";
	 // echo "<font size=-1>\n";
	  //echo "<a href='./changePassword.php'>Change My Password</a>\n";
	  //echo "</font>\n";
	  //echo "</td>\n";

	  //logout
	  echo "<td align=right valign=bottom>\n";
	  echo "<font size=-1>\n";
	  echo "<a href='./logout.php'>Change User</a>\n";
	  echo "</font>\n";
	  echo "</td>\n";

	  //finish this top row
	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";
	  echo "</tr>\n";

	  //now the sidebar and body
	  echo "<tr>\n";
	  echo "<td width=10 background='./images/lt_blue.gif'>\n";
	  echo "<img src={$imgTrans} width=10 height=50>\n";
	  echo "</td>\n";
	  //sidebar
	  echo "<td background='./images/lt_blue.gif' valign=top>\n";
	  echo "<center>\n";
	  //echo "<a href='./index.php'><img src='./images/logo_simple.gif' width=119 height=119 border=0></a>\n";
	  echo "<a href='./index.php'><img src='./images/logo_quill.gif' width=119 height=119 border=0></a>\n";
	  echo "</center>\n";
	  echo "<br>\n";

	  echo "<font size=-1>\n";
	  echo "<img src={$imgTrans} width=155 height=10>\n";
          echo "<br>\n";

	  //PUT SIDE BAR LINKS HERE
	  //echo "<p>User Manual link\n";
	  //echo "<p>FAQ link<br>\n";
	  echo "</font>\n";
	  echo "</td>\n";

	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";

          //now start up the cell that has the actual main part of our page
	  echo "<td colspan=2 valign=top>\n";
        }

        /** the cdbFinishPage function puts the rest of the stuff on to close out
            the page
        */
        function cdbFinishPage() {

          $imgTrans = "'./images/transparent.gif'";

	  echo "</td>\n";
	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";
	  echo "</tr>\n";

	  echo "<tr background='./images/lt_blue.gif'>\n";
	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";

	  echo "<td width=165>\n";
	  //echo "<font size=-1>Home Screen link</font>\n";

	  echo "</td>\n";
	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";

	  echo "<td colspan=2 align=right>\n";
	  //echo "<font size=-1>Software Version or other info</font>\n";
	  echo "</td>\n";

	  echo "<td width=10>\n";
	  echo "<img src={$imgTrans} width=10 height=10>\n";
	  echo "</td>\n";
	  echo "</tr>\n";

	  echo "</table>\n";


	  echo "</font>\n";
	  echo "</body>\n";
	  echo "</html>\n";
        }
?>
